


using Mengsk.ProxyDelivery.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Mengsk.ProxyDelivery.Service
{
    public class LoginHistoryService : ServiceBase<LoginHistory>
    {
        private const string APIURL_DELETE = "/webservice/loginhistory/delete.html";

        public DataCollection<LoginHistory> GetByAllOfSeller(int sellerId, LoginHistorySourceTypes source, string ipAddress, int result, DateTime startTime, DateTime endTime, int pageIndex, int pageSize)
        {
            Request req = new Request { Api = "getByAll" };
            req.Add("sellerId", sellerId);
            req.Add("source", source);
            req.Add("ipAddress", ipAddress);
            req.Add("result", result);
            req.Add("startTime", this.FormatToDBTime(startTime));
            req.Add("endTime", this.FormatToDBTime(endTime));
            req.Add("pageIndex", pageIndex);
            req.Add("pageSize", pageSize);
            return this.DoRemoteCall<LoginHistory>(req).ToDataCollection();
        }

        public void Delete(long[] ids)
        {
            if (ids == null || ids.Length < 1)
            {
                return;
            }
            Dictionary<string, string> param = new Dictionary<string, string>();
            param["ids"] = string.Join(",", ids);
            this.DoPost<int>(APIURL_DELETE, param);
        }
    }
}
